home *** CD-ROM | disk | FTP | other *** search
- From: clamage@Eng.Sun.COM (Steve Clamage)
- Message-ID: <4h2abb$l69@engnews1.Eng.Sun.COM>
- X-Original-Date: 28 Feb 1996 19:27:39 GMT
- Path: in2.uu.net!bounce-back
- Date: 29 Feb 96 06:18:35 GMT
- Approved: fjh@cs.mu.oz.au
- Return-Path: <daemon@meeker.UCAR.EDU>
- Newsgroups: comp.std.c++
- Subject: Re: An Extra Virtual Destructor Question t
- Organization: Sun Microsystems Inc.
- References: <4h25rb$43e@news.xs4all.nl>
- Reply-To: clamage@Eng.Sun.COM
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMTVFWOEDnX0m9pzZAQG9kQF+NI3B7ynBoragrR571XBshEPXD8rJw7Wh
- HnMa3m5dbXkcarC17NbzkaXZyfVKLcO0
- =YXRa
-
- In article 43e@news.xs4all.nl, veldhuis@xs4all.nl (Wim Veldhuis) writes:
- >In message <47voa1$969@gabi.gabi-soft.fr> - kanze@gabi-soft.fr (J. Kanze)
- >writes:
- >:>
- >:>john (j.d.) hickin (hickin@bnr.ca) wrote:
- >:>
- >:>|> class X { public: X(); virtual ~X() = 0; };
- >:>
- >:>|> Has this been considered?
- >:>
- >:>In what way? This has always been legal, and I see nothing in the
- >:>present draft to change it. I occasionally use the idiom to force a
- >:>class to be abstract even when I want to provide default behavior for
- >:>all of the member functions.
-
- >... What you are saying here is that there is somewhere in the draft
- >a rule which states that if a dtor is declared pure virtual, a default
- >implementation (or none at all) is automatically created. Is this the case ?
-
- No, and I don't think he was implying that it was the case.
-
- You are always allowed to provide an implementation of a pure virtual
- function. That function will never be called via the virtual function
- call mechanism, however. If you do call a pure virtual function
- explicitly, it must be implemented.
-
- The compiler will generate calls to the pure virtual destructor if
- any derived type is destroyed (you can't create objects of type X).
- If you declare a member function, the compiler does not generate it
- for you. Thus, if you declare a pure virtual destructor, you usually
- must implement it as well.
- ---
- Steve Clamage, stephen.clamage@eng.sun.com
- ---
- [ To submit articles: try just posting with your news-reader.
- If that fails, use mailto:std-c++@ncar.ucar.edu
- FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
- Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu.
- ]
-